class AudioDescriptor():
    
    data = None
    
    def __init__(self, data):
        self.data = data

        #for i in data:
        #    print i
                
    def getLang(self):
        
        if 'language' in self.data:
            return self.data['language'].strip()

    def getCodec(self):
        
        tr = {
                  'default' : '???',
                  
                  'A_VORBIS' : 'OGG',
                  'Vorbis' : 'OGG',
                  
                  'MPEG Layer 3' : 'MP3',
                  'MPEG Layer 3 (fourcc:"U")' : 'MP3',
                  'A_MPEG/L3' : 'MP3',
                  
                  'AC3' : 'AC3',
                  'A_AC3' : 'AC3',
                  
                  'A_DTS' : 'DTS',
                  
                  'Windows Media Audio V7 / V8 / V9' : 'WMA'
              }
        
        
        if(self.data['compression']):
            codec =  self.data['compression'].strip()
            
            try:
                codec = tr[codec]
            except KeyError, err:
                print "* Audio codec : '%s' is unknown, falling back to default" % codec
                print self.data
                codec = tr['default'] + '(%s)' % codec
            return codec